@import "./config.scss";

// 模块
@mixin module($block) {
  $B: "as-" + $block !global;
  .#{$B} {
    @content;
  }
}

// 元素
@mixin element($element) {
  #{& + "__" + $element} {
    @content;
  }
}

// 状态
@mixin when($state) {
  @at-root {
    &.is-#{$state} {
      @content;
    }
  }
}

// 修饰符
@mixin modifier($m) {
  $selector: &;
  $currenSelector: "";
  @each $unit in $m {
    $currenSelector: #{$currenSelector + & + "--" + $unit + ","};
  }

  @at-root {
    #{$currenSelector} {
      @content;
    }
  }
}
